import os


def start_http():
    exec_command(
        'source /root/water_applets/venv/bin/activate;cd /root/water_applets/;uwsgi --ini uwsgi.ini &')


def start_websocket():
    exec_command(
        'source /root/water_applets/venv/bin/activate;cd /root/water_applets/;daphne -b 0.0.0.0 -p 8889 '
        'water_applets.asgi:application &')


def exec_command(cmd):
    os.system(cmd)


def main():
    start_http()
    start_websocket()


main()
